package com.icss.lesson3;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

public class TestMain8 {
    public static void main(String[] args) throws Exception {
        File f = new File("D:/a.txt");
        FileInputStream f1 = new FileInputStream(f);
        FileChannel ichannel = f1.getChannel();
        FileOutputStream f2 = new FileOutputStream("D:/a_copy.txt");
        FileChannel ochannel = f2.getChannel();
        ichannel.transferTo(0, f.length(), ochannel);

    }
}
